home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / COILDSGN.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-28  |  10.6 KB  |  377 lines

  1. 10  'COILDSGN - Coil Design - 22 NOV 94 rev. 05 JAN 97
  2. 20  CLS:KEY OFF
  3. 30  IF EX$=""THEN EX$="EXIT"
  4. 40  IF PROG$=""THEN GO$=EX$ ELSE GO$=PROG$
  5. 50  COMMON EX$,PROG$,LX
  6. 60  IF UH THEN UH=INT(UH*10^3+0.5)/10^3
  7. 70  COLOR 7,0,1
  8. 80  DIM GA(40)   'AWG gauge
  9. 90  DIM G#(9,2)  'shotgun gauges
  10. 100  DIM P$(11,2)  'pipe sizes
  11. 110  UL$=STRING$(80,205)
  12. 120  U1$="####.###"
  13. 130  U2$="####.#"
  14. 140  PI=3.14159
  15. 150  '
  16. 160  '.....AWG calculator
  17. 170  K=(0.46/0.005)^(1/39)    'increment multiplier
  18. 180  FOR Z=1 TO 40
  19. 190  N=Z+3
  20. 200  GA(Z)=0.46/K^N
  21. 210  NEXT Z
  22. 220  '
  23. 230  '.....start
  24. 240  CLS
  25. 250  COLOR 15,2
  26. 260  PRINT " COIL DESIGNER";TAB(57);"by George Murphy VE3ERP ";
  27. 270  COLOR 1,0:PRINT STRING$(80,223);
  28. 280  COLOR 7,0
  29. 290  GOSUB 2960     'preface - page 1
  30. 300  COLOR 0,7:LOCATE 25,22
  31. 310  PRINT " Press 1 to continue or 0 to EXIT.....";
  32. 320  COLOR 7,0
  33. 330  Z$=INKEY$:IF Z$=""THEN 330
  34. 340  IF Z$="0"THEN CLS:CHAIN GO$
  35. 350  IF Z$="1"THEN 370
  36. 360  GOTO 330
  37. 370  GOSUB 3640     'screen dump
  38. 380  LN=3:GOSUB 740 'clear screen
  39. 390  '
  40. 400  PRINT " Press number in < > to choose standard units of measure:"
  41. 410  PRINT UL$;
  42. 420  PRINT "  < 1 >  Metric"
  43. 430  PRINT "  < 2 >  U.S.A./Imperial"
  44. 440  Z$=INKEY$
  45. 450  IF Z$="1"THEN UM=25.4:UM$=" mm":GOTO 480
  46. 460  IF Z$="2"THEN UM=1:UM$=" in.":GOTO 480
  47. 470  GOTO 440
  48. 480  LN=3:GOSUB 740     'clear screen
  49. 490  GOSUB 3370         'preface - page 2
  50. 500  PRINT UL$;
  51. 510  '
  52. 520  PRINT " Press letter in < > to select desired ";
  53. 530  PRINT "optimum Length-to-Diameter Ratio:"
  54. 540  PRINT UL$;
  55. 550  PRINT "   < a >  0.5:1"
  56. 560  PRINT "   < b >  1.0:1"
  57. 570  COLOR 15,2
  58. 580  PRINT "   < c >  1.5:1 COLOR recommended for most       "
  59. 590  PRINT "   < d >  2.0:1 ' amateur radio applications "
  60. 600  COLOR 7,0
  61. 610  PRINT "   < e >  2.5:1"
  62. 620  PRINT "   < f >  3.0:1"
  63. 630  PRINT "   < g >  4.0:1";
  64. 640  Z$=INKEY$
  65. 650  IF Z$="a"THEN LD=0.5:GOTO 780
  66. 660  IF Z$="b"THEN LD=1:GOTO 780
  67. 670  IF Z$="c"THEN LD=1.5:GOTO 780
  68. 680  IF Z$="d"THEN LD=2:GOTO 780
  69. 690  IF Z$="e"THEN LD=2.5:GOTO 780
  70. 700  IF Z$="f"THEN LD=3:GOTO 780
  71. 710  IF Z$="g"THEN LD=4:GOTO 780
  72. 720  GOTO 640
  73. 730  '
  74. 740  '.....erase screen to bottom
  75. 750  VIEW PRINT LN TO 24:CLS:VIEW PRINT:LOCATE LN
  76. 760  RETURN
  77. 770  '
  78. 780  '.....start
  79. 790  CLS
  80. 800  '.....input inductance
  81. 810  COLOR 0,7:PRINT " DESIGN SPECIFICATIONS for a";
  82. 820  PRINT STR$(LD);":1 length-to-diameter ratio coil:"
  83. 830  COLOR 7,0
  84. 840  IF UH THEN 880
  85. 850  INPUT " ENTER: Inductance (>H)......................";UH
  86. 860  LN=CSRLIN-1:GOSUB 740
  87. 870  IF UH=0 THEN BEEP:GOTO 850
  88. 880  PRINT "        Inductance...........................";USING U1$;UH;
  89. 890  PRINT " >H"
  90. 900  LN=CSRLIN
  91. 910  IF WHIP=0 THEN 980
  92. 920  PRINT UL$;
  93. 930  PRINT TAB(7);
  94. 940  PRINT "FOR MOBILE WHIP LOADING COILS USE THE LARGEST PRACTICABLE DIAMETER"
  95. 950  PRINT TAB(7);
  96. 960  PRINT "WIRE OR TUBING CONDUCTOR."
  97. 970  '
  98. 980  '.....input conductor size
  99. 990  IF W THEN AWG=W:DIA=GA(AWG):GOTO 1190
  100. 1000  IF DIA THEN 1190
  101. 1010  'LN=CSRLIN
  102. 1020  PRINT UL$;
  103. 1030  PRINT " Press letter in < > to describe coil conductor size:"
  104. 1040  PRINT UL$;
  105. 1050  PRINT "   < a >  Diameter in millimetres"
  106. 1060  PRINT "   < b >  Diameter in inches"
  107. 1070  PRINT "   < c >  AWG#"
  108. 1080  Z$=INKEY$
  109. 1090  IF Z$="a"OR Z$="A"THEN WS$="mm":GOTO 1130
  110. 1100  IF Z$="b"OR Z$="B"THEN WS$="inches":GOTO 1130
  111. 1110  IF Z$="c"OR Z$="C"THEN WS$="AWG#":GOTO 1130
  112. 1120  GOTO 1080
  113. 1130  PRINT " ENTER: Conductor diameter (";WS$;")";:INPUT Z
  114. 1140  IF WS$="mm"THEN DIA=Z/25.4
  115. 1150  IF WS$="inches"THEN DIA=Z
  116. 1160  IF WS$="AWG#"THEN AWG=Z:DIA=GA(Z)
  117. 1170  GOSUB 740
  118. 1180  '
  119. 1190  PRINT "        Conductor diameter...................";USING U1$;DIA*UM;
  120. 1200  PRINT UM$;", "
  121. 1210  LN=CSRLIN
  122. 1220  PRINT UL$;
  123. 1230  PRINT " Press number in <> to select conductor type:"
  124. 1240  PRINT UL$;
  125. 1250  PRINT "  < 1 > Bare"
  126. 1260  PRINT "  < 2 > Enamelled"
  127. 1270  PRINT "  < 3 > Insulated"
  128. 1280  W$=INKEY$
  129. 1290  IF W$="1" THEN WIR$="bare":SP=2*DIA:GOTO 1340
  130. 1300  IF W$="2" THEN WIR$="enamelled":SP=DIA+0.005:GOTO 1340
  131. 1310  IF W$="3" THEN WIR$="insulated":GOTO 1340
  132. 1320  GOTO 1280
  133. 1330  '
  134. 1340  '.....turns per inch
  135. 1350  LOCATE 3,60:PRINT WIR$;
  136. 1360  IF AWG THEN PRINT " (AWG#";USING "###";AWG;:PRINT ")" ELSE PRINT ""
  137. 1370  IF W$="1"OR W$="2"THEN 1480
  138. 1380  GOSUB 740
  139. 1390  PRINT UL$;
  140. 1400  TB=9
  141. 1410  PRINT TAB(TB);
  142. 1420  PRINT "Wrap some of the #";AWG;WIR$;" wire around a ruler to determine"
  143. 1430  PRINT TAB(TB);
  144. 1440  PRINT "the maximum number of turns that can be wound in 25mm (1 inch)."
  145. 1450  PRINT UL$;
  146. 1460  INPUT " ENTER: How many turns can be wound in 25mm (1 inch)";TPI
  147. 1470  SP=1/TPI
  148. 1480  GOSUB 740
  149. 1490  PRINT "        Approximate spacing of coil turns....";USING U1$;SP*UM;
  150. 1500  PRINT UM$
  151. 1510  '
  152. 1520  '.....calculate coil length and form diameter by iteration
  153. 1530  CD=0.25                       'default coil diameter
  154. 1540  PRINT "........Iterating........please wait........."
  155. 1550  L=LD*CD                      'length=L/D ratio x diameter
  156. 1560  N=(SQR(UH*(18*CD+40*L)))/CD  'number of turns
  157. 1570  IF (N*SP)>L THEN CD=CD+0.000999999:GOTO 1550
  158. 1580  '
  159. 1590  T=1/SP                       'turns per inch
  160. 1600  IF W$="1" THEN X=DIA         'X=O.D.of wire c/w insulation, if any
  161. 1610  IF W$="2"OR W$="3"THEN X=SP
  162. 1620  CF=CD-X                      'coil form diameter
  163. 1630  '
  164. 1640  LN=CSRLIN-1:GOSUB 740
  165. 1650  PRINT "        Coil diameter........................";USING U1$;(CF+X)*UM;
  166. 1660  PRINT UM$
  167. 1670  PRINT "        Outside diameter of coil form.....";
  168. 1680  COLOR 14,4:PRINT " D=";:COLOR 7,0:PRINT USING U1$;CF*UM;
  169. 1690  PRINT UM$
  170. 1700  COLOR 14,4:LOCATE CSRLIN-1,58:PRINT " * ";:COLOR 7,0
  171. 1710  PRINT "        Number of turns......................";USING U1$;N;
  172. 1720  PRINT "        Length of coil.......................";USING U1$;L*UM;
  173. 1730  PRINT UM$
  174. 1740  PRINT "        Number of turns per 25 mm (inch).....";USING U2$;T
  175. 1750  PRINT "        Length-to-Diameter ratio.............";USING U1$;L/CD;
  176. 1760  PRINT ":1"
  177. 1770  LOCATE CSRLIN,9
  178. 1780  COLOR 14,4:PRINT " * ";
  179. 1790  COLOR 0,7
  180. 1800  PRINT " Coil form diameter can be any size near";
  181. 1810  COLOR 14,4:PRINT " D ";
  182. 1820  COLOR 0,7:PRINT " ":COLOR 7,0
  183. 1830  PRINT UL$;
  184. 1840  LOCATE CSRLIN-1,18
  185. 1850  PRINT " SOME SUGGESTED SOURCES OF COIL FORM MATERIAL "
  186. 1860  PRINT " PVC pipe outside diameters:";
  187. 1870  PRINT TAB(39)"Shotgun shell diameters:"
  188. 1880  LN=CSRLIN
  189. 1890  DATA 3/8,1/2,3/4," 1 "," 1DEFSTR"," 1RENUM"," 2 "," 2RENUM"," 3 "," 3RENUM"," 4 "
  190. 1900  DATA .675, .84, 1.05, 1.315, 1.66, 1.9, 2.375, 2.875, 3.5, 4, 4.5
  191. 1910  FOR Y=1 TO 11:READ P$(Y,1):NEXT Y
  192. 1920  FOR Y=1 TO 11:READ P$(Y,2):NEXT Y
  193. 1930  FOR Y=1 TO 11
  194. 1940  PRINT "   nom. ";P$(Y,1);" =";USING "##.###";VAL(P$(Y,2));
  195. 1950  PRINT " in. (";USING "###.#";VAL(P$(Y,2))*25.4;:PRINT " mm)";
  196. 1960  IF Y<11 THEN PRINT ""
  197. 1970  NEXT Y
  198. 1980  LOCATE LN
  199. 1990  '
  200. 2000  DATA ".410  ", .41, 28-Ga., .55, 20-Ga., .615, 16-Ga., .662
  201. 2010  DATA 12-Ga., .729, 10-Ga., .775,"","","","","",""
  202. 2020  FOR Y=1 TO 6:READ G$(Y,1),G$(Y,2)
  203. 2030  LOCATE ,42:PRINT G$(Y,1);USING "#####.###";VAL(G$(Y,2));
  204. 2040  PRINT " in. (";USING "###.#";VAL(G$(Y,2))*25.4;:PRINT " mm)"
  205. 2050  NEXT Y
  206. 2060  RESTORE
  207. 2070  LOCATE 21,42
  208. 2080  COLOR 14,4:PRINT " * ";
  209. 2090  COLOR 0,7
  210. 2100  PRINT " ENTER: Your choice of outside "
  211. 2110  LOCATE 22,42
  212. 2120  PRINT " diameter of coil form (";UM$;")...";
  213. 2130  INPUT CF
  214. 2140  CF=CF/UM
  215. 2150  COLOR 7,0
  216. 2160  LOCATE 6,43:PRINT "..."     'delete D=
  217. 2170  LOCATE 6,58:PRINT "   "     'delete asterisk
  218. 2180  LN=11
  219. 2190  GOSUB 740
  220. 2200  PRINT
  221. 2210  '
  222. 2220  '.....re-calculate
  223. 2230  CD=CF+X                         'coil diameter
  224. 2240  R=CD/2                          'coil radius
  225. 2250  Q=R^2*T^2/UH                    'factor
  226. 2260  L=ABS(-10-SQR(100+36*R*Q))/2/Q  'length of winding
  227. 2270  N=(SQR(UH*(18*CD+40*L)))/CD     'number of turns
  228. 2280  T=N/L                           'turns per inch
  229. 2290  COLOR 0,7
  230. 2300  PRINT " ALTERNATE DESIGN FOR A ^";STR$(CF*UM);UM$;" COIL FORM:"
  231. 2310  COLOR 7,0
  232. 2320  GOSUB 2350
  233. 2330  GOTO 2550
  234. 2340  '
  235. 2350  '.....screen print
  236. 2360  PRINT "        Inductance...........................";USING U1$;UH;
  237. 2370  PRINT " >H"
  238. 2380  PRINT "        Conductor diameter...................";USING U1$;DIA*UM;
  239. 2390  PRINT UM$;", ";WIR$;
  240. 2400  IF AWG THEN PRINT " (AWG#";USING "###";AWG;:PRINT ")" ELSE PRINT ""
  241. 2410  PRINT "        Approximate spacing of coil turns....";USING U1$;SP*UM;
  242. 2420  PRINT UM$
  243. 2430  PRINT "        Coil diameter........................";USING U1$;(CF+X)*UM;
  244. 2440  PRINT UM$
  245. 2450  PRINT "        Outside diameter of coil form........";USING U1$;CF*UM;
  246. 2460  PRINT UM$
  247. 2470  PRINT "        Number of turns......................";USING U1$;N;
  248. 2480  PRINT "        Length of coil.......................";USING U1$;L*UM;
  249. 2490  PRINT UM$
  250. 2500  PRINT "        Number of turns per 25 mm (inch).....";USING U2$;T
  251. 2510  PRINT "        Length-to-Diameter ratio.............";USING U1$;L/CD;
  252. 2520  PRINT ":1"
  253. 2530  RETURN
  254. 2540  '
  255. 2550  IF N=INT(N)THEN Z$="n":GOTO 2600
  256. 2560  COLOR 0,7
  257. 2570  PRINT " Do you want to adjust the number of turns?  (y/n)";
  258. 2580  COLOR 7,0
  259. 2590  Z$=INKEY$
  260. 2600  IF Z$="n"THEN LN=CSRLIN:GOSUB 740:GOTO 2790
  261. 2610  IF Z$="y"THEN 2640
  262. 2620  GOTO 2590
  263. 2630  '
  264. 2640  '.....recalculate length
  265. 2650  LNX=LN:LN=CSRLIN:GOSUB 740
  266. 2660  COLOR 0,7
  267. 2670  INPUT " ENTER: How many turns ";N
  268. 2680  COLOR 7,0
  269. 2690  L=((CD^2*N^2/UH)-(18*CD))/40
  270. 2700  SP=L/N
  271. 2710  T=N/L
  272. 2720  LN=LNX:GOSUB 740:LOCATE LNX+1
  273. 2730  COLOR 0,7
  274. 2740  PRINT " ALTERNATE DESIGN FOR";N;
  275. 2750  PRINT "TURNS ON A ^";STR$(CF*UM);UM$;" COIL FORM:"
  276. 2760  COLOR 7,0
  277. 2770  GOSUB 2350
  278. 2780  '
  279. 2790  '.....end
  280. 2800  LW=(CD*PI*N)      'length in inches
  281. 2810  IF UM=25.4 THEN UM=0.0254:UM$=" m."
  282. 2820  PRINT "        Approx.length of conductor required..";USING U1$;LW*UM;
  283. 2830  PRINT UM$
  284. 2840  PRINT
  285. 2850  COLOR 0,7:PRINT " Do you want to try another coil of the same ";
  286. 2860  PRINT "inductance? (y/n) ";:COLOR 7,0
  287. 2870  Z$=INKEY$: IF Z$=""THEN 2870
  288. 2880  IF Z$="y"THEN CLS:GOTO 490
  289. 2890  IF Z$="n"THEN LOCATE CSRLIN-1:PRINT STRING$(79,32);:GOTO 2910
  290. 2900  GOTO 2870
  291. 2910  GOSUB 3640
  292. 2920  UH=0:DIA=0
  293. 2930  IF EX$<>GO$ THEN CHAIN GO$
  294. 2940  GOTO 230    'start
  295. 2950  '
  296. 2960  '.....preface - page 1
  297. 2970  TB=7
  298. 2980  PRINT TAB(TB);
  299. 2990  PRINT "This program designs single-layer air-core coils using formulae"
  300. 3000  PRINT TAB(TB);
  301. 3010  PRINT "published in the 1996 ARRL HANDBOOK, page 6.22. These formulae"
  302. 3020  PRINT TAB(TB);
  303. 3030  PRINT "provide close approximations of values for frequencies in the 1-30"
  304. 3040  PRINT TAB(TB);
  305. 3050  PRINT "MHz range that are sufficiently accurate for most Amateur Radio"
  306. 3060  PRINT TAB(TB);
  307. 3070  PRINT "purposes. The calculations are useful in the VHF and UHF range but"
  308. 3080  PRINT TAB(TB);
  309. 3090  PRINT "only as a basis for further calculation and experimentation."
  310. 3100  PRINT
  311. 3110  PRINT TAB(TB);
  312. 3120  PRINT "The program designs CLOSE-WOUND coils. Turn spacing is calculated"
  313. 3130  PRINT TAB(TB);
  314. 3140  PRINT "as follows:"
  315. 3150  PRINT
  316. 3160  PRINT TAB(TB);
  317. 3170  PRINT " - BARE CONDUCTOR (wire or tubing) @ twice its diameter."
  318. 3180  PRINT TAB(TB);
  319. 3190  PRINT "   (you can use scraps of the same size conductor as turn spacers)."
  320. 3200  PRINT
  321. 3210  PRINT TAB(TB);
  322. 3220  PRINT " - ENAMELLED WIRE @ wire diameter + .005";CHR$(34);".  ( .127 mm )"
  323. 3230  PRINT
  324. 3240  PRINT TAB(TB);
  325. 3250  PRINT " - INSULATED WIRE @ outside diameter of the insulation."
  326. 3260  PRINT
  327. 3270  PRINT TAB(TB);
  328. 3280  PRINT "The accuracy of the formulae used in this program may decrease if"
  329. 3290  PRINT TAB(TB);
  330. 3300  PRINT "the recommended turn spacing is greatly increased. In every case"
  331. 3310  PRINT TAB(TB);
  332. 3320  PRINT "spread the windings evenly over the winding length and secure in"
  333. 3330  PRINT TAB(TB);
  334. 3340  PRINT "place with shellac or other suitable coating."
  335. 3350  RETURN
  336. 3360  '
  337. 3370  'preface - page 2
  338. 3380  PRINT TAB(TB);
  339. 3390  PRINT "The ratio of coil length to coil diameter can affect the Q of a"
  340. 3400  PRINT TAB(TB);
  341. 3410  PRINT "single-layer close-wound coil. A high Q ensures improved circuit"
  342. 3420  PRINT TAB(TB);
  343. 3430  PRINT "efficiency, a narrower bandwidth and less wide-band noise in"
  344. 3440  PRINT TAB(TB);
  345. 3450  PRINT "oscillator circuits. In designing a high Q coil the following"
  346. 3460  PRINT TAB(TB);
  347. 3470  PRINT "parameters should be considered:"
  348. 3480  PRINT
  349. 3490  PRINT TAB(TB);
  350. 3500  PRINT "- The conductor diameter should be as large as practicable."
  351. 3510  IF WHIP=1 THEN 3540
  352. 3520  PRINT TAB(TB);
  353. 3530  PRINT "- The turn spacing should be as close as practicable."
  354. 3540  PRINT TAB(TB);
  355. 3550  PRINT "- The coil form should have a low dielectric constant. Air is best."
  356. 3560  PRINT TAB(TB);
  357. 3570  PRINT "- The Length-to-Diameter Ratio should not exceed 4:1. Ratios of"
  358. 3580  PRINT TAB(TB);
  359. 3590  PRINT "  between 1:1 and 2:1 are preferred for most circuits. In no case"
  360. 3600  PRINT TAB(TB);
  361. 3610  PRINT "  should the ratio be less than 0.4:1."
  362. 3620  RETURN
  363. 3630  '
  364. 3640  'HARDCOPY
  365. 3650  GOSUB 3760:LOCATE 25,2:COLOR 14,6
  366. 3660  PRINT " Press 1 to print screen, 2 to print screen & ";
  367. 3670  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  368. 3680  Z$=INKEY$:IF Z$="3"THEN GOSUB 3760:RETURN
  369. 3690  IF Z$="1"OR Z$="2"THEN GOSUB 3760:GOTO 3710
  370. 3700  GOTO 3680
  371. 3710  FOR QX=1 TO 24:FOR QY=1 TO 80
  372. 3720  LPRINT CHR$(SCREEN(QX,QY));
  373. 3730  NEXT QY:NEXT QX
  374. 3740  IF Z$="2"THEN LPRINT CHR$(12)
  375. 3750  GOTO 3650
  376. 3760  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  377.